from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

from openai import OpenAI
client = OpenAI(base_url="https://api.deepseek.com/beta")

comment = "// 找出所有水仙花数并返回"
prompt = f"""请根据由中括号包含的说明完成代码函数实现，
    仅实现函数，不要返回测试代码或其他任何信息。
    [{comment}]"""

messages = [
    {"role": "user", "content": prompt },
    {"role": "assistant", "content": "```JavaScript\n", "prefix": True}
]
response = client.chat.completions.create(
    model="deepseek-chat",
    messages=messages,
    stop="```",
)
print(response.choices[0].message.content)